[XEN] memory_op hypercall does not use guest_handle_add_offset().
It was causing compatibility issues across architectures as
on x86 the effect would not persist across a continuation. On
x86/64 and powerpc (both of which use xencomm) the effect would
persist. This patch sidesteps the whole issue.
Ian Campbell [Fri, 10 Nov 2006 12:34:26 +0000 (12:34 +0000)]
PV-on-HVM: Do not enable barriers in blkfront before 2.6.16
Barrier support was rewritten after 2.6.15. Perhaps it would be
possible to implement support for old kernels as well but for now it
is easier to just disable them.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
[HVM] Clarify ioreq interactions between Xen and qemu-dm.
Mainly this involves placing appropriate barriers before
updating the shared state variable, and after reading from it. The
model is that it is state switches that drive the transfer of data to
and fro in the shared ioreq structure. So writers should wmb() before
updating the variable; readers should rmb() after seeing a state
change.
These barriers aren't actually required given the current code
structure since the communication flow is really driven by
event-channel notifications, which happen to provide a sufficient
barrier. However, relying on this for all time and on all
architectures seems foolish and the barriers have negligible cost
compared with the totoal ioreq round-trip latency. Also the model of
communications being driven by the shared-memory state variable more
closely matches other inter-domain protocols (where there is usually a
shared-memory producer index), and is hence a model we are familiar
with and likely to implement correctly.
Tim Deegan [Fri, 10 Nov 2006 09:50:35 +0000 (09:50 +0000)]
[LIBFSIMAGE] Further 64bit compile fix
64bit libext2fs can have __u64 defined as unsigned long long,
while a uint64_t is unsigned long, and GCC complains.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Ewan Mellor [Thu, 9 Nov 2006 11:02:48 +0000 (11:02 +0000)]
Replace uses of the typename (e.g. xen_host) where its used as a variable name.
This is an unusual style, and out of sync with the rest of the library.
First, only save the bits that can be set, so that on a subsequent
read can't see MBZ bits as set. Next, be sure to initialize the
timer_divide_count, which is derived from the TDCR. This avoids a
potential divide-by-zero elsewhere in the code.
The original patch was provided by Ben Thomas <ben@virtualiron.com>.
This modified version refactors the code slightly and renames
timer_divide_count to timer_divisor.
[HVM] Clean up IOREQ state managemnet and evtchn notifications.
Based on a patch from Xin Li <xin.b.li@intel.com>. Changed
significantly on the Xen side -- not as cut down as the original
patch: this one keeps the xen_event_channel 'API' unchanged. Signed-off-by: Keir Fraser <keir@xensource.com>
[BLK] Add support for barrier writes to blkfront/blkback.
Protocol changes:
* There is a new operation (BLKIF_OP_WRITE_BARRIER)
to pass on barrier requests.
* There is a new state (BLKIF_RSP_EOPNOTSUPP) to indicate
unsupported operations (barrier writes may fail depending
on the underlying block device).
* A new xenstore node named "feature-barrier" indicates the
backend is able to handle barrier writes. The value can
be 1 (all is fine) or 0 (underlying block device doesn't
support barriers).
blkback changes: Add "feature-barrier" node to indicate barrier
support, pass incoming barrier requests to the block layer using
submit_bio(WRITE_BARRIER, bio). Some error handling fixes to
properly pass through barrier write failures, so the frontend
can turn off barriers then.
blkfront changes: Check if the backend sets "feature-barrier", if
present switch to QUEUE_ORDERED_DRAIN mode. Send off barrier
requests to the backend using the new BLKIF_OP_WRITE_BARRIER
operation. Also some error handling for the EOPNOTSUPP case.
Background: Barriers are needed to make journaling filesystems work
reliable. For some requests they need order constrains to make the
transactions work correctly. Barrier requests are used to pass that
ordering information to the block layer and/or to the device, so the
constrains are obeyed when reordering requests for better write
performance.
Tim Deegan [Thu, 9 Nov 2006 16:05:23 +0000 (16:05 +0000)]
[XEN] Console keystroke to reset shadows.
In debug builds, adds a keyhandler that blows away all shadows, to
force them to be rebuilt. Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
[HVM] Clarify the HVM e820 map. Also make it rather more
conservative wrt the ACPI region. hvmloader should fix up
by freeing unused memory in the range 0xE0000-0x100000. Signed-off-by: Keir Fraser <keir@xensource.com>
Tim Deegan [Thu, 9 Nov 2006 14:09:53 +0000 (14:09 +0000)]
Add libfsimage, a C library for reading files from filesystem images.
Initial support is provided for Solaris UFS, ext2 (both using libext2fs
and not), and reiserfs.
[VMXASSIST] Fix mishandling of segment registers on entry into VM86_PROTECTED mode.
The bug occurs when the guest is entering protected mode and reaches
the far jump to set up the 32-bit segment registers for the virtual
VMENTER we're about to perform. vmxassist, in protected_mode(), looks
at the segment registers, which might be 16-bit segments or might be
32-bit segment selectors at this stage (depending on whether the OS
has reloaded them since entering protected mode); and it tries to load
the segments from the GDT. Unconditionally. Even if the segment
register still actually contains a real mode 16-bit segment. Whoops.
vmxassist already has code to detect 16-bit segments that survived
unmodified from a transition into and out of protected mode, and to
save and restore those appropriately. It does this using
"saved_rm_regs", which get cleared on entry to protected mode, and
then set to the old segment value if we fail to set a given 32-bit
segment correctly.
The fix is to save the 16-bit segments *always*, on entry to protected
mode when %CR0(PE) is first set; and to clear the saved 16-bit segment
and set the 32-bit variant in oldctx whenever a 32-bit segment
descriptor is set during the transition to 32-bit CS. Then, when we
finally do the VMENTER, we will set up the VMCS from only the 32-bit
segments, clearing the VMCS entries for segments that have not been
assigned valid 32-bit segments yet.
Tested on various RHEL-5 boot.isos, including ones which worked before
and ones which triggered the bug; all now boot correctly.
[XENSTORE] Fix xenstore-ls program to connect via kernel xenbus
connection by default, like all other client utils. Signed-off-by: Keir Fraser <keir@xensource.com>
Alastair Tse [Thu, 9 Nov 2006 12:36:20 +0000 (12:36 +0000)]
[XEND][XM] Move system memory reporting to XendConfig rather than getSysMem.
Remove the additional XMLRPC calls per domain just to get system
memory and instead make sure we update that value and return it via
the SXP that gets returned when xm list is called.
Ewan Mellor [Wed, 8 Nov 2006 18:29:16 +0000 (18:29 +0000)]
Write the /local/domain/<domid>/vm node early in the startup process
(immediately after the domain is created). QEMU needs this in place when it
starts up, in order to find the VNC password.
[HVM] Avoid long delay between setting IRQ for PV drivers and
servicing it. Should call service_ioapic() synchronously. Signed-off-by: Keir Fraser <keir@xensource.com>
[HVM] Reserve 2 pages for ACPI tables in e820.
This is required when appending SSDTs to the core
ACPI data. Signed-off-by: Keir Fraser <keir@xensource.com>
[XEN] Do not print grant-table warning if a page cannot be pinned
because the (previous) owner is dying. This quietens down domain
destruction quite a bit. Signed-off-by: Keir Fraser <keir@xensource.com>
[VMX] __vmread() and __vmwrite() now BUG on failure, rather than
returning the error to the caller.
None of our vmcs reads/writes should fail. In fact many callers were
ignoring failures, which can hide bugs (in fact it hid one in
vmx_restore_dr(), which was incorrectly using __vmread() before
the vmcs was loaded).
__vmread_safe() is used by the vmcs dump function, which is the only
function which can legitimately fail a vmcs access.
[HVM] Simplify relationship between VIOAPIC and VLAPICs.
It's not really dynamic since there is always exactly
one VLAPIC per VCPU. Signed-off-by: Keir Fraser <keir@xensource.com>
Ewan Mellor [Wed, 8 Nov 2006 12:56:45 +0000 (12:56 +0000)]
Don't complain about name non-uniqueness if one domain is dying. This happens
across a reboot regularly. Inside _refresh, there is the occasion for new
domains to appear, if an existing domain reboots itself. In this case, we
need to get the list of running domains from Xen again.
Ewan Mellor [Wed, 8 Nov 2006 11:13:50 +0000 (11:13 +0000)]
Refresh the domain list on domain_start or domain_create. We need to do this
so that the list of running domains is up-to-date for the name-uniqueness
check.
[HVM] Remove bogus free of vlapic structure.
It is incorrect now that vlapic is embedded inside
the vcpu structure. Signed-off-by: Keir Fraser <keir@xensource.com>
Ewan Mellor [Wed, 8 Nov 2006 09:50:09 +0000 (09:50 +0000)]
This patch addresses bugzilla #649, enabling `xm list' to display the
actual amount of memory allocated by a guest. Also this patch:
- makes it more apparent that 'xm mem-set' has no effect on HVM's.
- show's that memory is changing if 'xm list' is issued while guest is
ballooning (w/o touching balloon driver)
Ewan Mellor [Wed, 1 Nov 2006 08:38:22 +0000 (08:38 +0000)]
The XenDomain class does not respect the arch defaults where
as XmTestDomain does. This part of the patch forces both HVM and
non-HVM tests to use XmTestDomain. With appropriate changes to the
extraConfig arg.
On PPC we need to use the arch defaults to get the console setup
correctly.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
[XEN] Put the non-GPL license text in each public header file.
This excludes arch-powerpc.h and xencomm.h which require
confirmation from the original authors that the existing GPL
text can be removed and replaced.
Original patch from: Mark Johnson <mark.johnson@sun.com> Signed-off-by: Keir Fraser <keir@xensource.com>
This required fiddling the asm constraints of the atomic bitops. It
seems gcc isn't entirely happy with "+m": the manual says that the
'+' modifier should be used only when a register constraint is
available.
[HVM] Replace shared-memory PIC state with a set-irq-level hypercall.
This simplifies the IRQ logic significantly and avoids the bogus
hvm_pic_assist() on domain resume path.
There is more work to be done here. At least:
1. set-irq-level should really be set-interrupt-wire-level. Wire
state needs to be distinguished from PIC (in particular, PIC IRR)
state.
2. Hypercalls can be batched in qemu and pushed down in one
multicall.
[BLKTAP] avoid race between tapdisk and xvd daemon with ufe_ring.
- Tapdisk updates rsp_cons by ioctl(). on the other hand xvd daemon
reads rsp_cons in do_block_io_op() with RING_FULL().
Copy request and memory barrier before updating rsp_cons.
- Tapdisk access req_prod_pvt with select(). on the other hand xvd
daemon updates it in do_block_io_op().
[BLKTAP] Various cleanups necessary for ia64 support.
- remove magic number 8 and 64.
page size / sector size is 8 on x86, however on ia64 page size is
16kb.
blkring size is 64 on x86. however it's 128 on ia64.
- replace 0xFFFF with INVALID_GRANT_HANDLE
- don't map io ring into user space with uncachable.
kernel access the page with cacable and tapdisk uses memory barrier
so that it isn't necessary.
- remove printk warning and inserted new line.
- remove unused variable, page.
- add one BUG()
[XENAPI] Add 'image' field to xen_vbd_record, allowing an image to be
associated with the vbd. xend supports this field and the client
bindings need it to support existing images that are not under
control of an SR.
[NET] back: Fix wrap to zero in transmit credit scheduler.
This could happen when credit_bytes == ~0UL (i.e., scheduling is 'disabled'). Signed-off-by: Kirk Allan <kallan@novell.com>
[HVM] MAke HVM hypercall table NR_hypercalls entries big.
Otherwise a buggy/malicious HVM guest can cause us to read
off the end of the table. Signed-off-by: George Dunlap <gdunlap@xensource.com>